package mailcommon.entities;

import java.io.Serializable;
import java.util.Date;
import mailcommon.helpers.DateHelper;

public class MailAddress implements Serializable {

    private String uniqueAddress;
    private Date creationDate;
    private int ownerId;

    public MailAddress() {
    }

    public MailAddress(String address, Date creationDate, int ownerId) {
        this.creationDate = creationDate;
        this.ownerId = ownerId;
        this.uniqueAddress = address;
    }

    public MailAddress(String address, String creationDate, int ownerId) {
        this(address, DateHelper.getInstance().parse(creationDate), ownerId);
    }

    @Override
    public String toString() {
        return uniqueAddress;
    }

    public String getUniqueAddres() {
        return uniqueAddress;
    }

    public Date getCreationDate() {
        return creationDate;
    }

    public String getCreationDateString() {
        return DateHelper.getInstance().format(creationDate);
    }

    public int getOwnerId() {
        return ownerId;
    }
}
